package com.deyuanyun.pic.ae.controller.vo;

import com.deyuanyun.pic.ae.domain.EmergencyResource;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import com.github.pagehelper.Page;

import java.math.BigDecimal;
import java.util.Date;

/**
 * E_7管道沿线应急资源信息表
 */
public class EmergencyResourceVO extends AEBaseVO<EmergencyResource> {

    // 应急资源名称
    private String name;
    // 应急资源类别AE_EMERGENCY_RESOURCE_TYPE（政府机构、医疗机构、急救中心、公安队伍、消防单位、供水局、供电局、维抢修队、疏散安置点、其它）
    private String type;
    // 省
    private String province;
    // 市
    private String city;
    // 区（县）
    private String district;
    // 镇（乡）
    private String town;
    // 村（街道）
    private String village;
    // 联系人
    private String contact;
    // 联系方式
    private String telephone;
    // 数据状态
    private String dataStated;
    private String gisid;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getTown() {
        return town;
    }

    public void setTown(String town) {
        this.town = town;
    }

    public String getVillage() {
        return village;
    }

    public void setVillage(String village) {
        this.village = village;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getDataStated() {
        return dataStated;
    }

    public void setDataStated(String dataStated) {
        this.dataStated = dataStated;
    }

    public String getGisid() {
        return gisid;
    }

    public void setGisid(String gisid) {
        this.gisid = gisid;
    }

    @Override
    public void fromDomain(EmergencyResource domain) {

        // 应急资源名称
        this.name = domain.getName();
        // 应急资源类别AE_EMERGENCY_RESOURCE_TYPE（政府机构、医疗机构、急救中心、公安队伍、消防单位、供水局、供电局、维抢修队、疏散安置点、其它）
        this.type = CodeUtil.getName(domain.getType());
        // 省
        this.province = domain.getProvince();
        // 市
        this.city = domain.getCity();
        // 区（县）
        this.district = domain.getDistrict();
        // 镇（乡）
        this.town = domain.getTown();
        // 村（街道）
        this.village = domain.getVillage();
        // 联系人
        this.contact = domain.getContact();
        // 联系方式
        this.telephone = domain.getTelephone();

        // 数据状态
        this.dataStated = domain.getDataStated();
        this.gisid = domain.getGisid();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    public Page<EmergencyResourceVO> fromDomainList(Page<EmergencyResource> domainList) {
        Page<EmergencyResourceVO> list = new Page<EmergencyResourceVO>();
        for (EmergencyResource emergencyResource : domainList) {
            EmergencyResourceVO emergencyResourceVO = new EmergencyResourceVO();
            emergencyResourceVO.fromDomain(emergencyResource);
            list.add(emergencyResourceVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}